﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WFL.Windows
{
    public static class Header
    {
        public static class Winuser
        {

            #region Messages

            public const int WM_ACTIVATE = 6;
            public const int WM_ACTIVATEAPP = 0x1c;
            public const int WM_AFXFIRST = 0x360;
            public const int WM_AFXLAST = 0x37f;
            public const int WM_APP = 0x8000;
            public const int WM_ASKCBFORMATNAME = 780;
            public const int WM_CANCELJOURNAL = 0x4b;
            public const int WM_CANCELMODE = 0x1f;
            public const int WM_CAPTURECHANGED = 0x215;
            public const int WM_CHANGECBCHAIN = 0x30d;
            public const int WM_CHANGEUISTATE = 0x127;
            public const int WM_CHAR = 0x102;
            public const int WM_CHARTOITEM = 0x2f;
            public const int WM_CHILDACTIVATE = 0x22;
            public const int WM_CHOOSEFONT_GETLOGFONT = 0x401;
            public const int WM_CLEAR = 0x303;
            public const int WM_CLOSE = 0x10;
            public const int WM_COMMAND = 0x111;
            public const int WM_COMMNOTIFY = 0x44;
            public const int WM_COMPACTING = 0x41;
            public const int WM_COMPAREITEM = 0x39;
            public const int WM_CONTEXTMENU = 0x7b;
            public const int WM_COPY = 0x301;
            public const int WM_COPYDATA = 0x4a;
            public const int WM_CREATE = 1;
            public const int WM_CTLCOLOR = 0x19;
            public const int WM_CTLCOLORBTN = 0x135;
            public const int WM_CTLCOLORDLG = 310;
            public const int WM_CTLCOLOREDIT = 0x133;
            public const int WM_CTLCOLORLISTBOX = 0x134;
            public const int WM_CTLCOLORMSGBOX = 0x132;
            public const int WM_CTLCOLORSCROLLBAR = 0x137;
            public const int WM_CTLCOLORSTATIC = 0x138;
            public const int WM_CUT = 0x300;
            public const int WM_DEADCHAR = 0x103;
            public const int WM_DELETEITEM = 0x2d;
            public const int WM_DESTROY = 2;
            public const int WM_DESTROYCLIPBOARD = 0x307;
            public const int WM_DEVICECHANGE = 0x219;
            public const int WM_DEVMODECHANGE = 0x1b;
            public const int WM_DISPLAYCHANGE = 0x7e;
            public const int WM_DRAWCLIPBOARD = 0x308;
            public const int WM_DRAWITEM = 0x2b;
            public const int WM_DROPFILES = 0x233;
            public const int WM_ENABLE = 10;
            public const int WM_ENDSESSION = 0x16;
            public const int WM_ENTERIDLE = 0x121;
            public const int WM_ENTERMENULOOP = 0x211;
            public const int WM_ENTERSIZEMOVE = 0x231;
            public const int WM_ERASEBKGND = 20;
            public const int WM_EXITMENULOOP = 530;
            public const int WM_EXITSIZEMOVE = 0x232;
            public const int WM_FONTCHANGE = 0x1d;
            public const int WM_GETDLGCODE = 0x87;
            public const int WM_GETFONT = 0x31;
            public const int WM_GETHOTKEY = 0x33;
            public const int WM_GETICON = 0x7f;
            public const int WM_GETMINMAXINFO = 0x24;
            public const int WM_GETOBJECT = 0x3d;
            public const int WM_GETTEXT = 13;
            public const int WM_GETTEXTLENGTH = 14;
            public const int WM_HANDHELDFIRST = 0x358;
            public const int WM_HANDHELDLAST = 0x35f;
            public const int WM_HELP = 0x53;
            public const int WM_HOTKEY = 0x312;
            public const int WM_HSCROLL = 0x114;
            public const int WM_HSCROLLCLIPBOARD = 0x30e;
            public const int WM_ICONERASEBKGND = 0x27;
            public const int WM_IME_CHAR = 0x286;
            public const int WM_IME_COMPOSITION = 0x10f;
            public const int WM_IME_COMPOSITIONFULL = 0x284;
            public const int WM_IME_CONTROL = 0x283;
            public const int WM_IME_ENDCOMPOSITION = 270;
            public const int WM_IME_KEYDOWN = 0x290;
            public const int WM_IME_KEYLAST = 0x10f;
            public const int WM_IME_KEYUP = 0x291;
            public const int WM_IME_NOTIFY = 0x282;
            public const int WM_IME_SELECT = 0x285;
            public const int WM_IME_SETCONTEXT = 0x281;
            public const int WM_IME_STARTCOMPOSITION = 0x10d;
            public const int WM_INITDIALOG = 0x110;
            public const int WM_INITMENU = 0x116;
            public const int WM_INITMENUPOPUP = 0x117;
            public const int WM_INPUTLANGCHANGE = 0x51;
            public const int WM_INPUTLANGCHANGEREQUEST = 80;
            public const int WM_KEYDOWN = 0x100;
            public const int WM_KEYFIRST = 0x100;
            public const int WM_KEYLAST = 0x108;
            public const int WM_KEYUP = 0x101;
            public const int WM_KILLFOCUS = 8;
            public const int WM_LBUTTONDBLCLK = 0x203;
            public const int WM_LBUTTONDOWN = 0x201;
            public const int WM_LBUTTONUP = 0x202;
            public const int WM_MBUTTONDBLCLK = 0x209;
            public const int WM_MBUTTONDOWN = 0x207;
            public const int WM_MBUTTONUP = 520;
            public const int WM_MDIACTIVATE = 0x222;
            public const int WM_MDICASCADE = 0x227;
            public const int WM_MDICREATE = 0x220;
            public const int WM_MDIDESTROY = 0x221;
            public const int WM_MDIGETACTIVE = 0x229;
            public const int WM_MDIICONARRANGE = 0x228;
            public const int WM_MDIMAXIMIZE = 0x225;
            public const int WM_MDINEXT = 0x224;
            public const int WM_MDIREFRESHMENU = 0x234;
            public const int WM_MDIRESTORE = 0x223;
            public const int WM_MDISETMENU = 560;
            public const int WM_MDITILE = 550;
            public const int WM_MEASUREITEM = 0x2c;
            public const int WM_MENUCHAR = 0x120;
            public const int WM_MENUSELECT = 0x11f;
            public const int WM_MOUSEACTIVATE = 0x21;
            public const int WM_MOUSEFIRST = 0x200;
            public const int WM_MOUSEHOVER = 0x2a1;
            public const int WM_MOUSELAST = 0x20a;
            public const int WM_MOUSELEAVE = 0x2a3;
            public const int WM_MOUSEMOVE = 0x200;
            public const int WM_MOUSEWHEEL = 0x20a;
            public const int WM_MOVE = 3;
            public const int WM_MOVING = 0x216;
            public const int WM_NCACTIVATE = 0x86;
            public const int WM_NCCALCSIZE = 0x83;
            public const int WM_NCCREATE = 0x81;
            public const int WM_NCDESTROY = 130;
            public const int WM_NCHITTEST = 0x84;
            public const int WM_NCLBUTTONDBLCLK = 0xa3;
            public const int WM_NCLBUTTONDOWN = 0xa1;
            public const int WM_NCLBUTTONUP = 0xa2;
            public const int WM_NCMBUTTONDBLCLK = 0xa9;
            public const int WM_NCMBUTTONDOWN = 0xa7;
            public const int WM_NCMBUTTONUP = 0xa8;
            public const int WM_NCMOUSELEAVE = 0x2a2;
            public const int WM_NCMOUSEMOVE = 160;
            public const int WM_NCPAINT = 0x85;
            public const int WM_NCRBUTTONDBLCLK = 0xa6;
            public const int WM_NCRBUTTONDOWN = 0xa4;
            public const int WM_NCRBUTTONUP = 0xa5;
            public const int WM_NCXBUTTONDBLCLK = 0xad;
            public const int WM_NCXBUTTONDOWN = 0xab;
            public const int WM_NCXBUTTONUP = 0xac;
            public const int WM_NEXTDLGCTL = 40;
            public const int WM_NEXTMENU = 0x213;
            public const int WM_NOTIFY = 0x4e;
            public const int WM_NOTIFYFORMAT = 0x55;
            public const int WM_NULL = 0;
            public const int WM_PAINT = 15;
            public const int WM_PAINTCLIPBOARD = 0x309;
            public const int WM_PAINTICON = 0x26;
            public const int WM_PALETTECHANGED = 0x311;
            public const int WM_PALETTEISCHANGING = 0x310;
            public const int WM_PARENTNOTIFY = 0x210;
            public const int WM_PASTE = 770;
            public const int WM_PENWINFIRST = 0x380;
            public const int WM_PENWINLAST = 0x38f;
            public const int WM_POWER = 0x48;
            public const int WM_POWERBROADCAST = 0x218;
            public const int WM_PRINT = 0x317;
            public const int WM_PRINTCLIENT = 0x318;
            public const int WM_QUERYDRAGICON = 0x37;
            public const int WM_QUERYENDSESSION = 0x11;
            public const int WM_QUERYNEWPALETTE = 0x30f;
            public const int WM_QUERYOPEN = 0x13;
            public const int WM_QUERYUISTATE = 0x129;
            public const int WM_QUEUESYNC = 0x23;
            public const int WM_QUIT = 0x12;
            public const int WM_RBUTTONDBLCLK = 0x206;
            public const int WM_RBUTTONDOWN = 0x204;
            public const int WM_RBUTTONUP = 0x205;
            public const int WM_REFLECT = 0x2000;
            public const int WM_RENDERALLFORMATS = 0x306;
            public const int WM_RENDERFORMAT = 0x305;
            public const int WM_SETCURSOR = 0x20;
            public const int WM_SETFOCUS = 7;
            public const int WM_SETFONT = 0x30;
            public const int WM_SETHOTKEY = 50;
            public const int WM_SETICON = 0x80;
            public const int WM_SETREDRAW = 11;
            public const int WM_SETTEXT = 12;
            public const int WM_SETTINGCHANGE = 0x1a;
            public const int WM_SHOWWINDOW = 0x18;
            public const int WM_SIZE = 5;
            public const int WM_SIZECLIPBOARD = 0x30b;
            public const int WM_SIZING = 0x214;
            public const int WM_SPOOLERSTATUS = 0x2a;
            public const int WM_STYLECHANGED = 0x7d;
            public const int WM_STYLECHANGING = 0x7c;
            public const int WM_SYSCHAR = 0x106;
            public const int WM_SYSCOLORCHANGE = 0x15;
            public const int WM_SYSCOMMAND = 0x112;
            public const int WM_SYSDEADCHAR = 0x107;
            public const int WM_SYSKEYDOWN = 260;
            public const int WM_SYSKEYUP = 0x105;
            public const int WM_TCARD = 0x52;
            public const int WM_THEMECHANGED = 0x31a;
            public const int WM_TIMECHANGE = 30;
            public const int WM_TIMER = 0x113;
            public const int WM_UNDO = 0x304;
            public const int WM_UNINITMENUPOPUP = 0x125;
            public const int WM_UPDATEUISTATE = 0x128;
            public const int WM_USER = 0x400;
            public const int WM_USERCHANGED = 0x54;
            public const int WM_VKEYTOITEM = 0x2e;
            public const int WM_VSCROLL = 0x115;
            public const int WM_VSCROLLCLIPBOARD = 0x30a;
            public const int WM_WINDOWPOSCHANGED = 0x47;
            public const int WM_WINDOWPOSCHANGING = 70;
            public const int WM_WININICHANGE = 0x1a;
            public const int WM_XBUTTONDBLCLK = 0x20d;
            public const int WM_XBUTTONDOWN = 0x20b;
            public const int WM_XBUTTONUP = 0x20c;

            /// <summary>
            /// 微软没有公开的Windows消息?
            /// </summary>
            public const int WM_GETSYSMENU = 0x313;

            public const int EM_CANUNDO = 0xc6;
            public const int EM_CHARFROMPOS = 0xd7;
            public const int EM_EMPTYUNDOBUFFER = 0xcd;
            public const int EM_GETFIRSTVISIBLELINE = 0xce;
            public const int EM_GETLINE = 0xc4;
            public const int EM_GETLINECOUNT = 0xba;
            public const int EM_GETMODIFY = 0xb8;
            public const int EM_GETPASSWORDCHAR = 210;
            public const int EM_GETSEL = 0xb0;
            public const int EM_LIMITTEXT = 0xc5;
            public const int EM_LINEFROMCHAR = 0xc9;
            public const int EM_LINEINDEX = 0xbb;
            public const int EM_LINESCROLL = 0xb6;
            public const int EM_POSFROMCHAR = 0xd6;
            public const int EM_REPLACESEL = 0xc2;
            public const int EM_SCROLL = 0xb5;
            public const int EM_SCROLLCARET = 0xb7;
            public const int EM_SETMARGINS = 0xd3;
            public const int EM_SETMODIFY = 0xb9;
            public const int EM_SETPASSWORDCHAR = 0xcc;
            public const int EM_SETREADONLY = 0xcf;
            public const int EM_SETSEL = 0xb1;
            public const int EM_UNDO = 0xc7;
            public const int EM_GETOLEINTERFACE = WM_USER + 60;

            public const int MN_GETHMENU = 0x01E5;

            #endregion


            public const int GWL_EXSTYLE = -20;
            public const int GWL_STYLE = -16;
            public const int GWL_WNDPROC = -4;
            public const int GWL_HINSTANCE = -6;
            public const int GWL_ID = -12;
            public const int GWL_USERDATA = -21;

            public const int GWLP_WNDPROC = -4;
            public const int GWLP_HINSTANCE = -6;
            public const int GWLP_ID = -12;
            public const int GWLP_USERDATA = -21;

            public const int DWL_DLGPROC = 4;
            public const int DWL_MSGRESULT = 0;
            public const int DWL_USER = 8;

            public readonly static int DWLP_DLGPROC = IntPtr.Size;
            public const int DWLP_MSGRESULT = 0;
            public readonly static int DWLP_USER = IntPtr.Size * 2;


            #region Window Styles

            public const uint WS_OVERLAPPED = 0x00000000;
            public const uint WS_POPUP = 0x80000000;
            public const uint WS_CHILD = 0x40000000;
            public const uint WS_MINIMIZE = 0x20000000;
            public const uint WS_VISIBLE = 0x10000000;
            public const uint WS_DISABLED = 0x08000000;
            public const uint WS_CLIPSIBLINGS = 0x04000000;
            public const uint WS_CLIPCHILDREN = 0x02000000;
            public const uint WS_MAXIMIZE = 0x01000000;
            public const uint WS_CAPTION = 0x00C00000;     /* WS_BORDER | WS_DLGFRAME  */
            public const uint WS_BORDER = 0x00800000;
            public const uint WS_DLGFRAME = 0x00400000;
            public const uint WS_VSCROLL = 0x00200000;
            public const uint WS_HSCROLL = 0x00100000;
            public const uint WS_SYSMENU = 0x00080000;
            public const uint WS_THICKFRAME = 0x00040000;
            public const uint WS_GROUP = 0x00020000;
            public const uint WS_TABSTOP = 0x00010000;

            public const uint WS_MINIMIZEBOX = 0x00020000;
            public const uint WS_MAXIMIZEBOX = 0x00010000;

            public const uint WS_TILED = WS_OVERLAPPED;
            public const uint WS_ICONIC = WS_MINIMIZE;
            public const uint WS_SIZEBOX = WS_THICKFRAME;
            public const uint WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW;

            /*
             * Common Window Styles
             */
            public const uint WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED |
                                         WS_CAPTION |
                                         WS_SYSMENU |
                                         WS_THICKFRAME |
                                         WS_MINIMIZEBOX |
                                         WS_MAXIMIZEBOX);

            public const uint WS_POPUPWINDOW = (WS_POPUP |
                                         WS_BORDER |
                                         WS_SYSMENU);

            public const uint WS_CHILDWINDOW = WS_CHILD;

            #endregion


            #region Extended Window Styles

            public const uint WS_EX_DLGMODALFRAME = 0x00000001;
            public const uint WS_EX_NOPARENTNOTIFY = 0x00000004;
            public const uint WS_EX_TOPMOST = 0x00000008;
            public const uint WS_EX_ACCEPTFILES = 0x00000010;
            public const uint WS_EX_TRANSPARENT = 0x00000020;

            public const uint WS_EX_MDICHILD = 0x00000040;
            public const uint WS_EX_TOOLWINDOW = 0x00000080;
            public const uint WS_EX_WINDOWEDGE = 0x00000100;
            public const uint WS_EX_CLIENTEDGE = 0x00000200;
            public const uint WS_EX_CONTEXTHELP = 0x00000400;

            public const uint WS_EX_RIGHT = 0x00001000;
            public const uint WS_EX_LEFT = 0x00000000;
            public const uint WS_EX_RTLREADING = 0x00002000;
            public const uint WS_EX_LTRREADING = 0x00000000;
            public const uint WS_EX_LEFTSCROLLBAR = 0x00004000;
            public const uint WS_EX_RIGHTSCROLLBAR = 0x00000000;

            public const uint WS_EX_CONTROLPARENT = 0x00010000;
            public const uint WS_EX_STATICEDGE = 0x00020000;
            public const uint WS_EX_APPWINDOW = 0x00040000;

            public const uint WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE);
            public const uint WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST);

            public const uint WS_EX_LAYERED = 0x00080000;

            public const uint WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritence of mirroring by children
            public const uint WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring

            public const uint WS_EX_COMPOSITED = 0x02000000;

            public const uint WS_EX_NOACTIVATE = 0x08000000;

            #endregion


            #region NcHitTest

            public const int HTERROR = -2;
            public const int HTTRANSPARENT = -1;
            public const int HTNOWHERE = 0;
            public const int HTCLIENT = 1;
            public const int HTCAPTION = 2;
            public const int HTSYSMENU = 3;
            public const int HTGROWBOX = 4;
            public const int HTSIZE = HTGROWBOX;
            public const int HTMENU = 5;
            public const int HTHSCROLL = 6;
            public const int HTVSCROLL = 7;
            public const int HTMINBUTTON = 8;
            public const int HTMAXBUTTON = 9;
            public const int HTLEFT = 10;
            public const int HTRIGHT = 11;
            public const int HTTOP = 12;
            public const int HTTOPLEFT = 13;
            public const int HTTOPRIGHT = 14;
            public const int HTBOTTOM = 15;
            public const int HTBOTTOMLEFT = 16;
            public const int HTBOTTOMRIGHT = 17;
            public const int HTBORDER = 18;
            public const int HTREDUCE = HTMINBUTTON;
            public const int HTZOOM = HTMAXBUTTON;
            public const int HTSIZEFIRST = HTLEFT;
            public const int HTSIZELAST = HTBOTTOMRIGHT;
            public const int HTOBJECT = 19;
            public const int HTCLOSE = 20;
            public const int HTHELP = 21;

            #endregion


            #region Hook

            public const int WH_CALLWNDPROC = 4;
            public const int WH_CALLWNDPROCRET = 12;
            public const int WH_CBT = 5;
            public const int WH_DEBUG = 9;
            public const int WH_FOREGROUNDIDLE = 11;
            public const int WH_GETMESSAGE = 3;
            public const int WH_JOURNALPLAYBACK = 1;
            public const int WH_JOURNALRECORD = 0;
            public const int WH_KEYBOARD = 2;
            public const int WH_KEYBOARD_LL = 13;
            public const int WH_MOUSE = 7;
            public const int WH_MOUSE_LL = 14;
            public const int WH_MSGFILTER = -1;
            public const int WH_SHELL = 10;
            public const int WH_SYSMSGFILTER = 6;
            public const int WH_HARDWARE = 8;

            public const int HC_ACTION = 0;

            public const int LLKHF_EXTENDED = 0x01;
            public const int LLKHF_INJECTED = 0x10;
            public const int LLKHF_ALTDOWN = 0x20;
            public const int LLKHF_UP = 0x80;

            public delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
            public delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam);

            #endregion


            #region WM_SETHOTKEY

            public const uint HOTKEYF_SHIFT = 0x01;
            public const uint HOTKEYF_CONTROL = 0x02;
            public const uint HOTKEYF_ALT = 0x04;
            public const uint HOTKEYF_EXT = 0x08;

            #endregion


            #region WM_HotKey

            public const int IDHOT_SNAPWINDOW = -1;
            public const int IDHOT_SNAPDESKTOP = -2;

            public const uint MOD_ALT = 0x01;
            public const uint MOD_CONTROL = 0x02;
            public const uint MOD_SHIFT = 0x04;
            public const uint MOD_WIN = 0x08;

            #endregion


            #region WM_SYSCOMMAND

            public const int SC_SIZE = 0xF000;
            public const int SC_MOVE = 0xF010;
            public const int SC_MINIMIZE = 0xF020;
            public const int SC_MAXIMIZE = 0xF030;
            public const int SC_NEXTWINDOW = 0xF040;
            public const int SC_PREVWINDOW = 0xF050;
            public const int SC_CLOSE = 0xF060;
            public const int SC_VSCROLL = 0xF070;
            public const int SC_HSCROLL = 0xF080;
            public const int SC_MOUSEMENU = 0xF090;
            public const int SC_KEYMENU = 0xF100;
            public const int SC_ARRANGE = 0xF110;
            public const int SC_RESTORE = 0xF120;
            public const int SC_TASKLIST = 0xF130;
            public const int SC_SCREENSAVE = 0xF140;
            public const int SC_HOTKEY = 0xF150;
            public const int SC_DEFAULT = 0xF160;
            public const int SC_MONITORPOWER = 0xF170;
            public const int SC_CONTEXTHELP = 0xF180;
            public const int SC_SEPARATOR = 0xF00F;
            public const int SC_ICON = SC_MINIMIZE;
            public const int SC_ZOOM = SC_MAXIMIZE;

            #endregion


            #region WM_DRAWITEM

            public const int ODT_MENU = 1;
            public const int ODT_LISTBOX = 2;
            public const int ODT_COMBOBOX = 3;
            public const int ODT_BUTTON = 4;
            public const int ODT_STATIC = 5;
            public const int ODT_TAB = 101;
            public const int ODT_LISTVIEW = 102;

            public const int ODA_DRAWENTIRE = 0x0001;
            public const int ODA_SELECT = 0x0002;
            public const int ODA_FOCUS = 0x0004;

            public const int ODS_SELECTED = 0x0001;
            public const int ODS_GRAYED = 0x0002;
            public const int ODS_DISABLED = 0x0004;
            public const int ODS_CHECKED = 0x0008;
            public const int ODS_FOCUS = 0x0010;
            public const int ODS_DEFAULT = 0x0020;
            public const int ODS_COMBOBOXEDIT = 0x1000;
            public const int ODS_HOTLIGHT = 0x0040;
            public const int ODS_INACTIVE = 0x0080;
            public const int ODS_NOACCEL = 0x0100;
            public const int ODS_NOFOCUSRECT = 0x0200;

            #endregion


            public const int SW_SCROLLCHILDREN = 0x0001;
            public const int SW_INVALIDATE = 0x0002;
            public const int SW_ERASE = 0x0004;
            public const int SW_SMOOTHSCROLL = 0x0010;


            #region SetWindowPos

            public const int HWND_TOP = 0;
            public const int HWND_BOTTOM = 1;
            public const int HWND_TOPMOST = -1;
            public const int HWND_NOTOPMOST = -2;

            public const uint SWP_NOSIZE = 0x0001;
            public const uint SWP_NOMOVE = 0x0002;
            public const uint SWP_NOZORDER = 0x0004;
            public const uint SWP_NOREDRAW = 0x0008;
            public const uint SWP_NOACTIVATE = 0x0010;
            public const uint SWP_FRAMECHANGED = 0x0020;  /* The frame changed: send WM_NCCALCSIZE */
            public const uint SWP_SHOWWINDOW = 0x0040;
            public const uint SWP_HIDEWINDOW = 0x0080;
            public const uint SWP_NOCOPYBITS = 0x0100;
            public const uint SWP_NOOWNERZORDER = 0x0200;  /* Don't do owner Z ordering */
            public const uint SWP_NOSENDCHANGING = 0x0400;  /* Don't send WM_WINDOWPOSCHANGING */
            public const uint SWP_DRAWFRAME = SWP_FRAMECHANGED;
            public const uint SWP_NOREPOSITION = SWP_NOOWNERZORDER;
            public const uint SWP_DEFERERASE = 0x2000;
            public const uint SWP_ASYNCWINDOWPOS = 0x4000;

            #endregion


            #region MENUITEMINFO

            public const uint MF_INSERT = 0x00000000;
            public const uint MF_CHANGE = 0x00000080;
            public const uint MF_APPEND = 0x00000100;
            public const uint MF_DELETE = 0x00000200;
            public const uint MF_REMOVE = 0x00001000;

            public const uint MF_BYCOMMAND = 0x00000000;
            public const uint MF_BYPOSITION = 0x00000400;

            public const uint MF_SEPARATOR = 0x00000800;

            public const uint MF_ENABLED = 0x00000000;
            public const uint MF_GRAYED = 0x00000001;
            public const uint MF_DISABLED = 0x00000002;

            public const uint MF_UNCHECKED = 0x00000000;
            public const uint MF_CHECKED = 0x00000008;
            public const uint MF_USECHECKBITMAPS = 0x00000200;

            public const uint MF_STRING = 0x00000000;
            public const uint MF_BITMAP = 0x00000004;
            public const uint MF_OWNERDRAW = 0x00000100;

            public const uint MF_POPUP = 0x00000010;
            public const uint MF_MENUBARBREAK = 0x00000020;
            public const uint MF_MENUBREAK = 0x00000040;

            public const uint MF_UNHILITE = 0x00000000;
            public const uint MF_HILITE = 0x00000080;

            public const uint MF_DEFAULT = 0x00001000;

            public const uint MF_SYSMENU = 0x00002000;
            public const uint MF_HELP = 0x00004000;

            public const uint MF_RIGHTJUSTIFY = 0x00004000;

            public const uint MF_MOUSESELECT = 0x00008000;


            public const uint MFT_STRING = MF_STRING;
            public const uint MFT_BITMAP = MF_BITMAP;
            public const uint MFT_MENUBARBREAK = MF_MENUBARBREAK;
            public const uint MFT_MENUBREAK = MF_MENUBREAK;
            public const uint MFT_OWNERDRAW = MF_OWNERDRAW;
            public const uint MFT_RADIOCHECK = 0x00000200;
            public const uint MFT_SEPARATOR = MF_SEPARATOR;
            public const uint MFT_RIGHTORDER = 0x00002000;
            public const uint MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY;


            /* Menu flags for Add/Check/EnableMenuItem() */
            public const uint MFS_GRAYED = 0x00000003;
            public const uint MFS_DISABLED = MFS_GRAYED;
            public const uint MFS_CHECKED = MF_CHECKED;
            public const uint MFS_HILITE = MF_HILITE;
            public const uint MFS_ENABLED = MF_ENABLED;
            public const uint MFS_UNCHECKED = MF_UNCHECKED;
            public const uint MFS_UNHILITE = MF_UNHILITE;
            public const uint MFS_DEFAULT = MF_DEFAULT;


            public const uint MIIM_STATE = 0x00000001;
            public const uint MIIM_ID = 0x00000002;
            public const uint MIIM_SUBMENU = 0x00000004;
            public const uint MIIM_CHECKMARKS = 0x00000008;
            public const uint MIIM_TYPE = 0x00000010;
            public const uint MIIM_DATA = 0x00000020;

            public const uint MIIM_STRING = 0x00000040;
            public const uint MIIM_BITMAP = 0x00000080;
            public const uint MIIM_FTYPE = 0x00000100;


            public const int HBMMENU_CALLBACK = -1;
            public const int HBMMENU_SYSTEM = 1;
            public const int HBMMENU_MBAR_RESTORE = 2;
            public const int HBMMENU_MBAR_MINIMIZE = 3;
            public const int HBMMENU_MBAR_CLOSE = 5;
            public const int HBMMENU_MBAR_CLOSE_D = 6;
            public const int HBMMENU_MBAR_MINIMIZE_D = 7;
            public const int HBMMENU_POPUP_CLOSE = 8;
            public const int HBMMENU_POPUP_RESTORE = 9;
            public const int HBMMENU_POPUP_MAXIMIZE = 10;
            public const int HBMMENU_POPUP_MINIMIZE = 11;


            public const uint MNS_NOCHECK = 0x80000000;
            public const uint MNS_MODELESS = 0x40000000;
            public const uint MNS_DRAGDROP = 0x20000000;
            public const uint MNS_AUTODISMISS = 0x10000000;
            public const uint MNS_NOTIFYBYPOS = 0x08000000;
            public const uint MNS_CHECKORBMP = 0x04000000;

            public const uint MIM_MAXHEIGHT = 0x00000001;
            public const uint MIM_BACKGROUND = 0x00000002;
            public const uint MIM_HELPID = 0x00000004;
            public const uint MIM_MENUDATA = 0x00000008;
            public const uint MIM_STYLE = 0x00000010;
            public const uint MIM_APPLYTOSUBMENUS = 0x80000000;

            #endregion


            #region WM_NCCALCSIZE

            public const int WVR_ALIGNTOP = 0x0010;
            public const int WVR_ALIGNLEFT = 0x0020;
            public const int WVR_ALIGNBOTTOM = 0x0040;
            public const int WVR_ALIGNRIGHT = 0x0080;
            public const int WVR_HREDRAW = 0x0100;
            public const int WVR_VREDRAW = 0x0200;
            public const int WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW);
            public const int WVR_VALIDRECTS = 0x0400;

            #endregion


            #region ShowWindow

            public const int SW_HIDE = 0;
            public const int SW_SHOWNORMAL = 1;
            public const int SW_NORMAL = 1;
            public const int SW_SHOWMINIMIZED = 2;
            public const int SW_SHOWMAXIMIZED = 3;
            public const int SW_MAXIMIZE = 3;
            public const int SW_SHOWNOACTIVATE = 4;
            public const int SW_SHOW = 5;
            public const int SW_MINIMIZE = 6;
            public const int SW_SHOWMINNOACTIVE = 7;
            public const int SW_SHOWNA = 8;
            public const int SW_RESTORE = 9;
            public const int SW_SHOWDEFAULT = 10;
            public const int SW_FORCEMINIMIZE = 11;
            public const int SW_MAX = 11;

            #endregion


            public const uint GA_PARENT = 1;
            public const uint GA_ROOT = 2;
            public const uint GA_ROOTOWNER = 3;


            #region CLIPFORMAT

            public const int CF_BITMAP = 2;
            public const int CF_DIB = 8;
            public const int CF_DIF = 5;
            public const int CF_DSPBITMAP = 130;
            public const int CF_DSPENHMETAFILE = 0x8e;
            public const int CF_DSPMETAFILEPICT = 0x83;
            public const int CF_DSPTEXT = 0x81;
            public const int CF_ENHMETAFILE = 14;
            public const int CF_HDROP = 15;
            public const int CF_LOCALE = 0x10;
            public const int CF_MAX = 0x11;
            public const int CF_METAFILEPICT = 3;
            public const int CF_OEMTEXT = 7;
            public const int CF_OWNERDISPLAY = 0x80;
            public const int CF_PALETTE = 9;
            public const int CF_PENDATA = 10;
            public const int CF_RIFF = 11;
            public const int CF_SYLK = 4;
            public const int CF_TEXT = 1;
            public const int CF_TIFF = 6;
            public const int CF_UNICODETEXT = 13;
            public const int CF_WAVE = 12;

            #endregion


            #region GetDCEx

            public const uint DCX_WINDOW = 0x00000001;
            public const uint DCX_CACHE = 0x00000002;
            public const uint DCX_NORESETATTRS = 0x00000004;
            public const uint DCX_CLIPCHILDREN = 0x00000008;
            public const uint DCX_CLIPSIBLINGS = 0x00000010;
            public const uint DCX_PARENTCLIP = 0x00000020;
            public const uint DCX_EXCLUDERGN = 0x00000040;
            public const uint DCX_INTERSECTRGN = 0x00000080;
            public const uint DCX_EXCLUDEUPDATE = 0x00000100;
            public const uint DCX_INTERSECTUPDATE = 0x00000200;
            public const uint DCX_LOCKWINDOWUPDATE = 0x00000400;
            public const uint DCX_VALIDATE = 0x00200000;

            #endregion


            #region SendInput

            public const uint INPUT_MOUSE = 0;
            public const uint INPUT_KEYBOARD = 1;
            public const uint INPUT_HARDWARE = 2;

            public const uint KEYEVENTF_EXTENDEDKEY = 0x01;
            public const uint KEYEVENTF_KEYUP = 0x02;
            public const uint KEYEVENTF_UNICODE = 0x04;
            public const uint KEYEVENTF_SCANCODE = 0x08;

            #endregion


            public const uint MOUSEEVENTF_MOVE = 0x0001;
            public const uint MOUSEEVENTF_LEFTDOWN = 0x0002;
            public const uint MOUSEEVENTF_LEFTUP = 0x0004;
            public const uint MOUSEEVENTF_RIGHTDOWN = 0x0008;
            public const uint MOUSEEVENTF_RIGHTUP = 0x0010;
            public const uint MOUSEEVENTF_MIDDLEDOWN = 0x0020;
            public const uint MOUSEEVENTF_MIDDLEUP = 0x0040;
            public const uint MOUSEEVENTF_XDOWN = 0x0080;
            public const uint MOUSEEVENTF_XUP = 0x0100;
            public const uint MOUSEEVENTF_WHEEL = 0x0800;
            public const uint MOUSEEVENTF_HWHEEL = 0x01000;
            public const uint MOUSEEVENTF_MOVE_NOCOALESCE = 0x2000;
            public const uint MOUSEEVENTF_VIRTUALDESK = 0x4000;
            public const uint MOUSEEVENTF_ABSOLUTE = 0x8000;

            public const uint MAPVK_VK_TO_VSC = 0;
            public const uint MAPVK_VSC_TO_VK = 1;
            public const uint MAPVK_VK_TO_CHAR = 2;
            public const uint MAPVK_VSC_TO_VK_EX = 3;
            public const uint MAPVK_VK_TO_VSC_EX = 4;


            #region GetWindowPlacement

            public const uint WPF_SETMINPOSITION = 0x0001;
            public const uint WPF_RESTORETOMAXIMIZED = 0x0002;
            public const uint WPF_ASYNCWINDOWPLACEMENT = 0x0004;

            #endregion



        }

        public static class Windef
        {
            public static ushort LOWORD(uint dwValue)
            {
                return (ushort)(dwValue & 0xffff);
            }

            public static ushort HIWORD(uint dwValue)
            {
                return (ushort)((dwValue >> 16) & 0xffff);
            }
        }

        public static class Windowsx
        {
            public static int GET_X_LPARAM(IntPtr lParam)
            {
                return (int)(short)(lParam.ToInt32() & 0xffff);
            }

            public static int GET_Y_LPARAM(IntPtr lParam)
            {
                return (int)(short)((lParam.ToInt32() >> 16) & 0xffff);
            }
        }

        public static class Richole
        {
            public const uint RECO_PASTE = 0;
            public const uint RECO_DROP = 1;
            public const uint RECO_COPY = 2;
            public const uint RECO_CUT = 3;
            public const uint RECO_DRAG = 4;

            public const uint REO_GETOBJ_NO_INTERFACES = 0;
            public const uint REO_GETOBJ_POLEOBJ = 1;
            public const uint REO_GETOBJ_PSTG = 2;
            public const uint REO_GETOBJ_POLESITE = 4;
            public const uint REO_GETOBJ_ALL_INTERFACES = 7;

            public const uint REO_BELOWBASELINE = 2;
            public const uint REO_BLANK = 0x10;
            public const uint REO_DONTNEEDPALETTE = 0x20;
            public const uint REO_DYNAMICSIZE = 8;
            public const uint REO_GETMETAFILE = 0x400000;
            public const uint REO_HILITED = 0x1000000;
            public const uint REO_INPLACEACTIVE = 0x2000000;
            public const uint REO_INVERTEDSELECT = 4;
            public const uint REO_LINK = 0x80000000;
            public const uint REO_LINKAVAILABLE = 0x800000;
            public const uint REO_NULL = 0;
            public const uint REO_OPEN = 0x4000000;
            public const uint REO_READWRITEMASK = 0x3f;
            public const uint REO_RESIZABLE = 1;
            public const uint REO_SELECTED = 0x8000000;
            public const uint REO_STATIC = 0x40000000;
        }

        public static class ObjBase
        {
            public const uint STGM_CONVERT = 0x20000;
            public const uint STGM_CREATE = 0x1000;
            public const uint STGM_DELETEONRELEASE = 0x4000000;
            public const uint STGM_DIRECT = 0;
            public const uint STGM_FAILIFTHERE = 0;
            public const uint STGM_NOSCRATCH = 0x100000;
            public const uint STGM_NOSNAPSHOT = 0x200000;
            public const uint STGM_PRIORITY = 0x40000;
            public const uint STGM_READ = 0;
            public const uint STGM_READWRITE = 2;
            public const uint STGM_SHARE_DENY_NONE = 0x40;
            public const uint STGM_SHARE_DENY_READ = 0x30;
            public const uint STGM_SHARE_DENY_WRITE = 0x20;
            public const uint STGM_SHARE_EXCLUSIVE = 0x10;
            public const uint STGM_SIMPLE = 0x8000000;
            public const uint STGM_TRANSACTED = 0x10000;
            public const uint STGM_WRITE = 1;
        }
    }
}
